package com.example.design_pattern.mediator;

/**
 * 抽象的同事类
 */
public abstract class Colleague {

    private Mediator mMediator;

    public Colleague(Mediator mMediator) {
        this.mMediator = mMediator;
    }

    /**
     * 当有别的同事对象发生变换时，调停者会回调该方法
     */
    public abstract void action();

    /**
     * 自己发生变化时调用，该方法的逻辑是调用调停者的colleagueChanged（）方法
     */
    public void changed(){
        mMediator.colleagueChanged(this);
    }
}
